<style scoped>
	.header {
	  width: 92%;
	  margin-left: 4%;
	  text-align: justify;
	}

	.user {
	  display: inline-block;
	}
	.nickname {
	    margin-left: 10px;
	    display: inline-block;
	    color:#444;
	}
	.publishtime {
	  display: inline-block;
	  color: #7B7B7B;
	}
	.content {
    text-align: left;
    width: 92%;
    margin-left: 4%;
    margin-bottom: 20px;
    color: #7B7B7B;
    border-bottom: 1px solid #E6E6E6;
    padding-bottom: 20px;
	}
</style>
<template>
	<div v-for="comment in comments">
		<div class="header">
			<div class="user">
				<img :src="comment.ownerInfo.headimgurl" height="40" width="40">
				<div class="nickname">{{comment.ownerInfo.nickname}}</div>
			</div>
			<div class="publishtime">
				<span style="margin-right:10px;">昨天</span><span>15:20</span>
			</div>
			<i style="display:inline-block;width:100%;height:0;"></i>
		</div>
		<div class="content">
			{{comment.content}}
		</div>
	</div>
	
</template>
<script>
	module.exports = {
		data:function(){
			return {
				comments:[],
				campPlace:null
			}
		},
		ready:function(){
			
		},
		events:{
			'child-campPlace':function(campPlace){
				var vue = this;
				vue.$http.get("/camp/comment/getInfo",{params:{id:campPlace._id}}).then(function(res){
					res.json().map(function(comment){
						console.log(9999);
						console.log(comment.ownerId);
						vue.$http.get("/camp/user/getInfoById",{params:{id:comment.ownerId}}).then(function(res){
							comment.ownerInfo = res.json()[0]
							vue.comments.push(comment);
						},function(err){
							console.log(err)
						});
					});
				},function(err){
					console.log(err);
				});
			}
		}
	}
</script>